#pragma once
#include <iostream>

struct MyAwaiter
{
    int value = 0;

    // 决定是否立即执行（不挂起）
    bool await_ready() const noexcept 
    {
        std::cout << "await_ready, value: " << value << std::endl;
        return false;
    }

    // 挂起协程并安排恢复
    void await_suspend(std::coroutine_handle<> handle) 
    {
        std::cout << "await_suspend, value: " << value << std::endl;
    }

    // 协程恢复时调用
    void await_resume() const noexcept 
    {
        std::cout << "await_resume, value: " << value << std::endl;
    }
};

